<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <xsl:output method="xml" indent="yes" />

  <xsl:template match="node()|@*">
    <xsl:choose>
      <xsl:when test="local-name()='ProjectReference'">
        <xsl:call-template name="ProjectReference"/>
      </xsl:when>
      <xsl:when test="starts-with(local-name(), 'Scc')" />
      <xsl:otherwise>
        <xsl:copy>
          <xsl:apply-templates select="@*"/>
          <xsl:apply-templates/>
        </xsl:copy>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template name="ProjectReference" >
    <Reference>
      <xsl:for-each select="child::*">
        <xsl:if test="local-name()='Name'">
          <xsl:choose>
            <xsl:when test="starts-with(text(), 'ComponentModel')">
              <xsl:attribute name="Include">Catalyst.<xsl:value-of select="."/></xsl:attribute>
            </xsl:when>
            <xsl:otherwise>
              <xsl:attribute name="Include">Catalyst.Web.<xsl:value-of select="."/></xsl:attribute>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:if>
      </xsl:for-each>
    </Reference>
  </xsl:template>

</xsl:stylesheet>